package cn.brilliantfuture.commentry.entity;

// Generated 2011-11-3 13:34:34 by Hibernate Tools 3.3.0.GA

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * Purchaser generated by hbm2java
 */
@Entity
@Table(name = "purchaser", catalog = "cabinet")
public class Purchaser implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private Integer purchaserId;
	private String name;
	private String phone;
	private CardInfo cardInfo;
	private String address;
	private String comment;
	private Date insertTime;
	private Integer insertUser;
	private boolean deleted;
	private String realname;
	private String password;
	private Integer sum;
	private String email;
	private Integer language;
	private Double amount;
	private boolean temporary = false;
	private Set<StorageGridPurchaser> storageGridPurchasers = new HashSet<StorageGridPurchaser>(
			0);
	private Set<OrderInformation> orderInformations = new HashSet<OrderInformation>(
			0);
	private Set<DeliveryAddress> deliveryAddresses = new HashSet<DeliveryAddress>(
			0);
	private Set<PurchaserGroup> purchaserGroups = new HashSet<PurchaserGroup>(0);
	private Set<StorageGridPurchaserNews> storageGridPurchaserNewses = new HashSet<StorageGridPurchaserNews>(
			0);
	private Set<StorageServiceInfo> storageServiceInfos = new HashSet<StorageServiceInfo>(0);
	private Set<StorageServiceKey> storageServiceKeys = new HashSet<StorageServiceKey>(0);
	public Purchaser() {
	}

	public Purchaser(String name, boolean deleted) {
		this.name = name;
		this.deleted = deleted;
	}

	public Purchaser(String name, String phone, String address, String comment,
			Date insertTime, Integer insertUser, boolean deleted, String realname,
			String password, Integer sum, String email, Integer language, Double amount, 
			Set<StorageGridPurchaser> storageGridPurchasers,
			Set<OrderInformation> orderInformations,
			Set<DeliveryAddress> deliveryAddresses,
			Set<PurchaserGroup> purchaserGroups,
			Set<StorageGridPurchaserNews> storageGridPurchaserNewses,
			CardInfo cardInfo) {
		this.name = name;
		this.phone = phone;
		this.address = address;
		this.comment = comment;
		this.insertTime = insertTime;
		this.insertUser = insertUser;
		this.deleted = deleted;
		this.realname = realname;
		this.password = password;
		this.sum = sum;
		this.email = email;
		this.language = language;
		this.amount = amount;
		this.storageGridPurchasers = storageGridPurchasers;
		this.orderInformations = orderInformations;
		this.deliveryAddresses = deliveryAddresses;
		this.purchaserGroups = purchaserGroups;
		this.storageGridPurchaserNewses = storageGridPurchaserNewses;
		this.cardInfo = cardInfo;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "purchaser_id", unique = true, nullable = false)
	public Integer getPurchaserId() {
		return this.purchaserId;
	}

	public void setPurchaserId(Integer purchaserId) {
		this.purchaserId = purchaserId;
	}

	@Column(name = "name", nullable = false, length = 45)
	@NotNull
	@Length(max = 45)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "phone", length = 45)
	@Length(max = 45)
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column(name = "address", length = 200)
	@Length(max = 200)
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "comment", length = 200)
	@Length(max = 200)
	public String getComment() {
		return this.comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "insert_time", length = 19)
	public Date getInsertTime() {
		return this.insertTime;
	}

	public void setInsertTime(Date insertTime) {
		this.insertTime = insertTime;
	}

	@Column(name = "insert_user")
	public Integer getInsertUser() {
		return this.insertUser;
	}

	public void setInsertUser(Integer insertUser) {
		this.insertUser = insertUser;
	}

	@Column(name = "deleted", nullable = false)
	public boolean isDeleted() {
		return this.deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	@Column(name = "realname", length = 45)
	@Length(max = 45)
	public String getRealname() {
		return this.realname;
	}

	public void setRealname(String realname) {
		this.realname = realname;
	}

	@Column(name = "password", length = 45)
	@Length(max = 45)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "sum")
	public Integer getSum() {
		return this.sum;
	}

	public void setSum(Integer sum) {
		this.sum = sum;
	}

	@Column(name = "email", length = 100)
	@Length(max = 100)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "language")
	public Integer getLanguage() {
		return this.language;
	}

	public void setLanguage(Integer language) {
		this.language = language;
	}

	@Column(name = "amount", precision = 22, scale = 0)
	public Double getAmount() {
		return this.amount;
	}

	public void setAmount(Double amount) {
		this.amount = amount;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "purchaser")
	public Set<StorageGridPurchaser> getStorageGridPurchasers() {
		return this.storageGridPurchasers;
	}

	public void setStorageGridPurchasers(
			Set<StorageGridPurchaser> storageGridPurchasers) {
		this.storageGridPurchasers = storageGridPurchasers;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "purchaser")
	public Set<OrderInformation> getOrderInformations() {
		return this.orderInformations;
	}

	public void setOrderInformations(Set<OrderInformation> orderInformations) {
		this.orderInformations = orderInformations;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "purchaser")
	public Set<DeliveryAddress> getDeliveryAddresses() {
		return this.deliveryAddresses;
	}

	public void setDeliveryAddresses(Set<DeliveryAddress> deliveryAddresses) {
		this.deliveryAddresses = deliveryAddresses;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "purchaser")
	public Set<PurchaserGroup> getPurchaserGroups() {
		return this.purchaserGroups;
	}

	public void setPurchaserGroups(Set<PurchaserGroup> purchaserGroups) {
		this.purchaserGroups = purchaserGroups;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "purchaser")
	public Set<StorageGridPurchaserNews> getStorageGridPurchaserNewses() {
		return this.storageGridPurchaserNewses;
	}

	public void setStorageGridPurchaserNewses(
			Set<StorageGridPurchaserNews> storageGridPurchaserNewses) {
		this.storageGridPurchaserNewses = storageGridPurchaserNewses;
	}

	@OneToOne(optional = true, mappedBy = "purchaser")
	public CardInfo getCardInfo() {
		return cardInfo;
	}

	public void setCardInfo(CardInfo cardInfo) {
		this.cardInfo = cardInfo;
	}

	@Column(name = "temporary")
	public boolean isTemporary() {
		return temporary;
	}

	public void setTemporary(boolean temporary) {
		this.temporary = temporary;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "purchaser")
	public Set<StorageServiceInfo> getStorageServiceInfos() {
		return storageServiceInfos;
	}

	public void setStorageServiceInfos(Set<StorageServiceInfo> storageServiceInfos) {
		this.storageServiceInfos = storageServiceInfos;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "purchaser")
	public Set<StorageServiceKey> getStorageServiceKeys() {
		return storageServiceKeys;
	}

	public void setStorageServiceKeys(Set<StorageServiceKey> storageServiceKeys) {
		this.storageServiceKeys = storageServiceKeys;
	}

}
